package com.heima.config;


import com.heima.interceptor.Tokeninterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * 用来配置拦截器规则 继承 WebMvcConfigurationSupport
 */
@Configuration
public class WebConfig extends WebMvcConfigurationSupport {

    // 添加拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new Tokeninterceptor())
                .addPathPatterns("/**")
                // TODO 用来设置哪些路径不需要拦截，要根据你实际项目去调整
                .excludePathPatterns("/login/**");
    }
}